﻿#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    dataHandle = new DataHandle(ui->plot);
    dataHandle->setLabelPos(ui->lbl_pos);
    dataHandle->setSaveTextEdit(ui->txt_name);
    dataHandle->setSaveButton(ui->btn_save);
    dataHandle->setCBoxFiles(ui->cbox_files);
    dataHandle->InitDataAndUI();



    //    cusWin = new CustomWindow();
    //    CustomWindow* pWm = new CustomWindow();
    //    pWm->setTitle(QStringLiteral(" Chart"));
    //    pWm->setTopHeight(40);
    //    pWm->setIconShow(false);
    //    pWm->show();
    ////    pWm->setGeometry(geometry());
    //    pWm->setMouseTracking(true);
    //    pWm->_main_vlayout->addWidget(this);






}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_actionSaveAnthor_triggered()
{
    QString fileName = "test.ini";
    dataHandle->saveAnOtherFile(fileName);
}

void MainWindow::on_actionChoose_triggered()
{
    QString fileName = "test11.ini";
    dataHandle->openANewFile(fileName);
}

void MainWindow::on_actionAllSave_triggered()
{

}

void MainWindow::on_chk_showLegend_clicked()
{
    // 没选中不显示
    ui->chk_showLegend->checkState() == Qt::Unchecked ?
                dataHandle->isShowLegend(false) :
                dataHandle->isShowLegend(true);
}
